package net.projecteuler.problem6;

/*
 * Sum square difference
 */
public class SumSquare {
	public long getDifferenceSquare(int limit) {
		long sumOfSquare = 0;
		long sum = 0;
		long squareOfSum = 0;
		
		for (int i = 1; i <= limit; i++) {
			sumOfSquare += i * i;
			sum += i;
		}
		squareOfSum = sum * sum;
		return squareOfSum - sumOfSquare;
	}
}
